<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.library.entity.Book" %>
<%@ page import="com.library.entity.Admin" %>
<!DOCTYPE html>
<html>
<head>
    <title>图书管理系统 - 书籍详情</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
        }

        .header {
            background-color: #f8f9fa;
            padding: 10px 20px;
            border-bottom: 1px solid #e0e0e0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .header h1 {
            margin: 0;
            font-size: 20px;
            color: #333;
        }

        .user-info {
            display: flex;
            align-items: center;
        }

        .logout-btn {
            margin-left: 15px;
            padding: 5px 10px;
            background-color: #f8f9fa;
            border: 1px solid #ddd;
            border-radius: 4px;
            cursor: pointer;
            text-decoration: none;
            color: #333;
        }

        .nav-container {
            width: 200px;
            background-color: #f8f9fa;
            float: left;
            min-height: calc(100vh - 50px);
            border-right: 1px solid #e0e0e0;
        }

        .admin-label {
            padding: 15px;
            background-color: #e9ecef;
            font-weight: bold;
            border-bottom: 1px solid #ddd;
        }

        .nav-container ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .nav-container li {
            padding: 15px;
            cursor: pointer;
            border-bottom: 1px solid #e0e0e0;
        }

        .nav-container li:hover {
            background-color: #e9ecef;
        }

        .nav-container li a {
            text-decoration: none;
            color: #333;
            display: block;
        }

        .nav-container li.active {
            background-color: #007bff;
        }

        .nav-container li.active a {
            color: white;
        }

        .content-container {
            margin-left: 200px;
            padding: 20px;
        }

        .book-detail-card {
            background-color: white;
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            max-width: 800px;
        }

        .detail-item {
            margin-bottom: 15px;
            padding: 10px 0;
            border-bottom: 1px solid #eee;
        }

        .detail-label {
            font-weight: bold;
            color: #333;
            margin-bottom: 5px;
            font-size: 14px;
        }

        .detail-value {
            color: #666;
            font-size: 16px;
            line-height: 1.5;
        }

        .btn {
            padding: 8px 15px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            margin-right: 10px;
            text-decoration: none;
            display: inline-block;
        }

        .btn:hover {
            background-color: #0069d9;
        }

        .btn-secondary {
            background-color: #6c757d;
        }

        .btn-secondary:hover {
            background-color: #5a6268;
        }

        .action-buttons {
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid #eee;
        }
    </style>
</head>
<body>
    <!-- 顶部导航栏 -->
    <div class="header">
        <h1>图书管理系统</h1>
        <div class="user-info">
            欢迎您，<%=((Admin) request.getSession().getAttribute("admin")).getUsername()%>
            <a href="../common?method=logout" class="logout-btn">退出登录</a>
        </div>
    </div>

    <!-- 左侧导航栏 -->
    <div class="nav-container">
        <div class="admin-label">管理端</div>
        <ul>
            <li><a href="../admin?method=adminIndex">首页</a></li>
            <li class="active"><a href="../admin/book?method=bookManage">书籍</a></li>
            <li><a href="../admin/bookcopy?method=bookCopyManage">书籍副本</a></li>
            <li><a href="../admin/payrec?method=fineRecord">学生罚款记录</a></li>
        </ul>
    </div>

    <!-- 中间内容区域 -->
    <div class="content-container">
        <h2>书籍详情</h2>
        
        <% Book book = (Book) request.getAttribute("book"); %>
        <div class="book-detail-card">
            <div class="detail-item">
                <div class="detail-label">ISBN:</div>
                <div class="detail-value"><%= book.getISBN() != null ? book.getISBN() : "无" %></div>
            </div>
            
            <div class="detail-item">
                <div class="detail-label">书名:</div>
                <div class="detail-value"><%= book.getBname() != null ? book.getBname() : "无" %></div>
            </div>
            
            <div class="detail-item">
                <div class="detail-label">作者:</div>
                <div class="detail-value"><%= book.getAuthor() != null ? book.getAuthor() : "无" %></div>
            </div>
            
            <div class="detail-item">
                <div class="detail-label">出版社:</div>
                <div class="detail-value"><%= book.getPublisher() != null ? book.getPublisher() : "无" %></div>
            </div>
            
            <div class="detail-item">
                <div class="detail-label">出版日期:</div>
                <div class="detail-value"><%= book.getPubDate() != null ? book.getPubDate().toString() : "无" %></div>
            </div>
            
            <div class="detail-item">
                <div class="detail-label">中图分类号:</div>
                <div class="detail-value"><%= book.getClcNum() != null && !book.getClcNum().isEmpty() ? book.getClcNum() : "无" %></div>
            </div>
            
            <div class="detail-item">
                <div class="detail-label">简介:</div>
                <div class="detail-value"><%= book.getIntroduction() != null && !book.getIntroduction().isEmpty() ? book.getIntroduction() : "暂无简介" %></div>
            </div>
            
            <div class="detail-item">
                <div class="detail-label">状态:</div>
                <div class="detail-value"><%= book.getBookStatus() == 1 ? "已上架" : "已下架" %></div>
            </div>
            
            <div class="action-buttons">
                <a href="${pageContext.request.contextPath}/admin/bookManage?method=showEditForm&id=<%= book.getId() %>" class="btn">编辑书籍</a>
                <a href="${pageContext.request.contextPath}/admin/book?method=bookManage" class="btn btn-secondary">返回列表</a>
            </div>
        </div>
    </div>
</body>
</html> 